{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "eebf4bd9",
   "metadata": {},
   "outputs": [],
   "source": [
    "from PIL import Image\n",
    "import os\n",
    "\n",
    "for file in os.listdir(\"data/images\"):\n",
    "    if file.endswith(\".bmp\"):\n",
    "        img = Image.open(f\"data/images/{file}\")\n",
    "        img.save(f\"data/images_png/{file.replace('.bmp', '.jpg')}\", quality=95)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "8541af43",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Copied JPG: 5a5b737483eeecc61f97306dd9bbd31.jpg\n",
      "Copied JPG: 66874453的互联_驶入(无地磅)_20250624090451_848932351.jpg\n",
      "Copied JPG: 66874453的互联_驶入(有地磅)_20250624090452_848884290.jpg\n",
      "Copied JPG: 66874453的互联_驶出(有地磅)_20250624090452_849003063.jpg\n"
     ]
    }
   ],
   "source": [
    "\n",
    "import shutil\n",
    "for file in os.listdir(\"data/images\"):\n",
    "    file_path = os.path.join(\"data/images\", file)\n",
    "    if file.lower().endswith((\".jpg\", \".jpeg\")):\n",
    "        new_filename = file  # 保持原名\n",
    "        shutil.copy2(file_path, os.path.join(\"data/images_png/\", new_filename))\n",
    "        print(f\"Copied JPG: {file}\")\n",
    "    \n",
    "    # 如果是 PNG，直接复制到新文件夹\n",
    "    elif file.lower().endswith(\".png\"):\n",
    "        new_filename = file  # 保持原名\n",
    "        shutil.copy2(file_path, os.path.join(\"data/images_png/\", new_filename))\n",
    "        print(f\"Copied PNG: {file}\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "f8d74f03",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "['192.168.1.231_IPCamera 01_192.168.1.231_20250531064118_2911558.jpg', '192.168.1.231_IPCamera 01_192.168.1.231_20250531064140_2978362.jpg', '192.168.1.231_IPCamera 01_192.168.1.231_20250531064243_3127836.jpg', '192.168.1.231_IPCamera 01_192.168.1.231_20250531064249_3139750.jpg', '192.168.1.231_IPCamera 01_192.168.1.231_20250531064331_241662.jpg', '192.168.1.231_IPCamera 01_192.168.1.231_20250531064631_292035.jpg', '192.168.1.231_IPCamera 01_192.168.1.231_20250531064724_375573.jpg', '192.168.1.231_IPCamera 01_192.168.1.231_20250531073031_1242184.jpg', '192.168.1.231_IPCamera 01_192.168.1.231_20250531073714_1323850.jpg', '192.168.1.231_IPCamera 01_192.168.1.231_20250531074414_1405307.jpg', '192.168.1.231_IPCamera 01_192.168.1.231_20250531075215_1468805.jpg', '192.168.1.231_IPCamera 01_192.168.1.231_20250531075436_1550010.jpg', '192.168.1.231_IPCamera 01_192.168.1.231_20250531080359_7588677.jpg', '192.168.1.231_IPCamera 01_192.168.1.231_20250531080702_7653339.jpg', '192.168.1.231_IPCamera 01_192.168.1.231_20250531081608_7732419.jpg', '192.168.1.231_IPCamera 01_192.168.1.231_20250531082411_7825738.jpg', '192.168.1.231_IPCamera 01_192.168.1.231_20250531082828_7897775.jpg', '192.168.1.231_IPCamera 01_192.168.1.231_20250531083636_7974431.jpg', '192.168.1.231_IPCamera 01_192.168.1.231_20250531084052_8026997.jpg', '192.168.1.231_IPCamera 01_192.168.1.231_20250531084056_140505.jpg', '192.168.1.231_IPCamera 01_192.168.1.231_20250531084057_187928.jpg', '192.168.1.231_IPCamera 01_192.168.1.231_20250531084709_245573.jpg', '192.168.1.231_IPCamera 01_192.168.1.231_20250531084720_375135.jpg', '192.168.1.231_IPCamera 01_192.168.1.231_20250531085129_468589.jpg', '192.168.1.231_IPCamera 01_192.168.1.231_20250531085826_1216950.jpg', '192.168.1.231_IPCamera 01_192.168.1.231_20250531090807_1471046.jpg', '192.168.1.231_IPCamera 01_192.168.1.231_20250531090916_8643075.jpg', '192.168.1.231_IPCamera 01_192.168.1.231_20250531091243_8742522.jpg', '192.168.1.231_IPCamera 01_192.168.1.231_20250531092003_8803274.jpg', '192.168.1.231_IPCamera 01_192.168.1.231_20250531092004_8808159.jpg', '192.168.1.231_IPCamera 01_192.168.1.231_20250531092408_8906429.jpg', '192.168.1.231_IPCamera 01_192.168.1.231_20250531092423_8924553.jpg', '192.168.1.231_IPCamera 01_192.168.1.231_20250531092424_8928997.jpg', '192.168.1.231_IPCamera 01_192.168.1.231_20250531093001_8991289.jpg', '192.168.1.231_IPCamera 01_192.168.1.231_20250531093415_38474044.jpg', '192.168.1.231_IPCamera 01_192.168.1.231_20250531093716_38571867.jpg', '192.168.1.231_IPCamera 01_192.168.1.231_20250531094107_38626945.jpg', '192.168.1.231_IPCamera 01_192.168.1.231_20250531094517_38752664.jpg', '192.168.1.231_IPCamera 01_192.168.1.231_20250531094620_38816174.jpg', '192.168.1.231_IPCamera 01_192.168.1.231_20250531095309_38868164.jpg', '192.168.1.231_IPCamera 01_192.168.1.231_20250531095401_38939108.jpg', '192.168.1.231_IPCamera 01_192.168.1.231_20250531100818_39060564.jpg', '192.168.1.231_IPCamera 01_192.168.1.231_20250531101731_39128966.jpg', '192.168.1.231_IPCamera 01_192.168.1.231_20250531103649_2503251.jpg', '192.168.1.231_IPCamera 01_192.168.1.231_20250531104626_125226.jpg', '192.168.1.231_IPCamera 01_192.168.1.231_20250531110120_228618.jpg', '192.168.1.231_IPCamera 01_192.168.1.231_20250531110518_553239.jpg', '192.168.1.231_IPCamera 01_192.168.1.231_20250531110530_457797.jpg', '192.168.1.231_IPCamera 01_192.168.1.231_20250531111213_875136.jpg', '192.168.1.231_IPCamera 01_192.168.1.231_20250531111555_962878.jpg', '192.168.1.231_IPCamera 01_192.168.1.231_20250531112203_1328202.jpg', '192.168.1.231_IPCamera 01_192.168.1.231_20250531122039_1523579.jpg', '192.168.1.231_IPCamera 01_192.168.1.231_20250531124450_1929857.jpg', '192.168.1.231_IPCamera 01_192.168.1.231_20250531124822_2044733.jpg', '192.168.1.231_IPCamera 01_192.168.1.231_20250531124952_2119500.jpg', '192.168.1.231_IPCamera 01_192.168.1.231_20250531125311_2172217.jpg', '192.168.1.231_IPCamera 01_192.168.1.231_20250531125745_2240062.jpg', '192.168.1.231_IPCamera 01_192.168.1.231_20250531130753_2417244.jpg', '192.168.1.231_IPCamera 01_192.168.1.231_20250531131348_2494044.jpg', '192.168.1.231_IPCamera 01_192.168.1.231_20250531131934_2562668.jpg', '192.168.1.231_IPCamera 01_192.168.1.231_20250531133223_2674982.jpg', '192.168.1.231_IPCamera 01_192.168.1.231_20250531133743_2764165.jpg', '192.168.1.231_IPCamera 01_192.168.1.231_20250622091730_49694044.jpg', '192.168.1.231_IPCamera 01_192.168.1.231_20250622163646_49859670.jpg', '192.168.1.231_IPCamera 01_192.168.1.231_20250622163654_49871775.jpg', '192.168.1.231_IPCamera 01_192.168.1.231_20250622164101_50069015.jpg', '192.168.1.231_IPCamera 01_192.168.1.231_20250622165425_50603003.jpg', '192.168.1.231_IPCamera 01_192.168.1.231_20250622165632_51173339.jpg', '192.168.1.231_IPCamera 01_192.168.1.231_20250622170612_51537155.jpg', '192.168.1.231_IPCamera 01_192.168.1.231_20250622170625_51559613.jpg', '192.168.1.231_IPCamera 01_192.168.1.231_20250622170650_51957508.jpg', '192.168.1.231_IPCamera 01_192.168.1.231_20250622170658_51968105.jpg', '192.168.1.231_IPCamera 01_192.168.1.231_20250622171441_52101248.jpg', '192.168.1.231_IPCamera 01_192.168.1.231_20250622172001_52159900.jpg', '192.168.1.231_IPCamera 01_192.168.1.231_20250622180651_52314257.jpg', '192.168.1.231_IPCamera 01_192.168.1.231_20250622180652_52318054.jpg', '192.168.1.231_IPCamera 01_192.168.1.231_20250622180700_52328349.jpg', '192.168.1.231_IPCamera 02_192.168.1.231_20250531064116_2890178.jpg', '192.168.1.231_IPCamera 02_192.168.1.231_20250531064118_2898406.jpg', '192.168.1.231_IPCamera 02_192.168.1.231_20250531064139_2954924.jpg', '192.168.1.231_IPCamera 02_192.168.1.231_20250531064241_68004.jpg', '192.168.1.231_IPCamera 02_192.168.1.231_20250531064247_80148.jpg', '192.168.1.231_IPCamera 02_192.168.1.231_20250531064248_86126.jpg', '192.168.1.231_IPCamera 02_192.168.1.231_20250531064330_227742.jpg', '192.168.1.231_IPCamera 02_192.168.1.231_20250531064331_232627.jpg', '192.168.1.231_IPCamera 02_192.168.1.231_20250531064630_281459.jpg', '192.168.1.231_IPCamera 02_192.168.1.231_20250531064631_285532.jpg', '192.168.1.231_IPCamera 02_192.168.1.231_20250531064722_367441.jpg', '192.168.1.231_IPCamera 02_192.168.1.231_20250531064723_370830.jpg', '192.168.1.231_IPCamera 02_192.168.1.231_20250531073029_1226115.jpg', '192.168.1.231_IPCamera 02_192.168.1.231_20250531073030_1229480.jpg', '192.168.1.231_IPCamera 02_192.168.1.231_20250531073030_1233375.jpg', '192.168.1.231_IPCamera 02_192.168.1.231_20250531073711_1307477.jpg', '192.168.1.231_IPCamera 02_192.168.1.231_20250531073712_1311067.jpg', '192.168.1.231_IPCamera 02_192.168.1.231_20250531073712_1314417.jpg', '192.168.1.231_IPCamera 02_192.168.1.231_20250531074417_1413220.jpg', '192.168.1.231_IPCamera 02_192.168.1.231_20250531075210_1457389.jpg', '192.168.1.231_IPCamera 02_192.168.1.231_20250531075435_1524791.jpg', '192.168.1.231_IPCamera 02_192.168.1.231_20250531075436_1545844.jpg', '192.168.1.231_IPCamera 02_192.168.1.231_20250531080357_7574853.jpg', '192.168.1.231_IPCamera 02_192.168.1.231_20250531080358_7578794.jpg', '192.168.1.231_IPCamera 02_192.168.1.231_20250531080637_7684393.jpg', '192.168.1.231_IPCamera 02_192.168.1.231_20250531081625_7771097.jpg', '192.168.1.231_IPCamera 02_192.168.1.231_20250531082358_7804778.jpg', '192.168.1.231_IPCamera 02_192.168.1.231_20250531082831_7906288.jpg', '192.168.1.231_IPCamera 02_192.168.1.231_20250531083622_7954252.jpg', '192.168.1.231_IPCamera 02_192.168.1.231_20250531084059_193746.jpg', '192.168.1.231_IPCamera 02_192.168.1.231_20250531084059_8048052.jpg', '192.168.1.231_IPCamera 02_192.168.1.231_20250531084706_237829.jpg', '192.168.1.231_IPCamera 02_192.168.1.231_20250531085133_473454.jpg', '192.168.1.231_IPCamera 02_192.168.1.231_20250531085823_1195620.jpg', '192.168.1.231_IPCamera 02_192.168.1.231_20250531090243_1357736.jpg', '192.168.1.231_IPCamera 02_192.168.1.231_20250531090804_1464389.jpg', '192.168.1.231_IPCamera 02_192.168.1.231_20250531090914_8627198.jpg', '192.168.1.231_IPCamera 02_192.168.1.231_20250531091245_8748936.jpg', '192.168.1.231_IPCamera 02_192.168.1.231_20250531092001_8797056.jpg', '192.168.1.231_IPCamera 02_192.168.1.231_20250531092426_8934177.jpg', '192.168.1.231_IPCamera 02_192.168.1.231_20250531092958_8984060.jpg', '192.168.1.231_IPCamera 02_192.168.1.231_20250531093418_38480574.jpg', '192.168.1.231_IPCamera 02_192.168.1.231_20250531093713_38564029.jpg', '192.168.1.231_IPCamera 02_192.168.1.231_20250531093715_38533307.jpg', '192.168.1.231_IPCamera 02_192.168.1.231_20250531094104_38614610.jpg', '192.168.1.231_IPCamera 02_192.168.1.231_20250531094519_38759970.jpg', '192.168.1.231_IPCamera 02_192.168.1.231_20250531094619_38809627.jpg', '192.168.1.231_IPCamera 02_192.168.1.231_20250531095308_38863473.jpg', '192.168.1.231_IPCamera 02_192.168.1.231_20250531095358_38928768.jpg', '192.168.1.231_IPCamera 02_192.168.1.231_20250531100816_39048303.jpg', '192.168.1.231_IPCamera 02_192.168.1.231_20250531100818_39065965.jpg', '192.168.1.231_IPCamera 02_192.168.1.231_20250531101727_39121357.jpg', '192.168.1.231_IPCamera 02_192.168.1.231_20250531103652_2525003.jpg', '192.168.1.231_IPCamera 02_192.168.1.231_20250531104623_150993.jpg', '192.168.1.231_IPCamera 02_192.168.1.231_20250531110111_292012.jpg', '192.168.1.231_IPCamera 02_192.168.1.231_20250531110533_800231.jpg', '192.168.1.231_IPCamera 02_192.168.1.231_20250531111159_903923.jpg', '192.168.1.231_IPCamera 02_192.168.1.231_20250531111602_974765.jpg', '192.168.1.231_IPCamera 02_192.168.1.231_20250531112151_1309433.jpg', '192.168.1.231_IPCamera 02_192.168.1.231_20250531122037_1515331.jpg', '192.168.1.231_IPCamera 02_192.168.1.231_20250531124449_1916677.jpg', '192.168.1.231_IPCamera 02_192.168.1.231_20250531124450_1926900.jpg', '192.168.1.231_IPCamera 02_192.168.1.231_20250531124825_2055006.jpg', '192.168.1.231_IPCamera 02_192.168.1.231_20250531124951_2110400.jpg', '192.168.1.231_IPCamera 02_192.168.1.231_20250531125307_2156444.jpg', '192.168.1.231_IPCamera 02_192.168.1.231_20250531125807_2272538.jpg', '192.168.1.231_IPCamera 02_192.168.1.231_20250531130748_2397638.jpg', '192.168.1.231_IPCamera 02_192.168.1.231_20250531131352_2502785.jpg', '192.168.1.231_IPCamera 02_192.168.1.231_20250531131930_2553814.jpg', '192.168.1.231_IPCamera 02_192.168.1.231_20250531133219_2665379.jpg', '192.168.1.231_IPCamera 02_192.168.1.231_20250531133746_2773644.jpg', '192.168.1.231_IPCamera 02_192.168.1.231_20250622091727_49677654.jpg', '192.168.1.231_IPCamera 02_192.168.1.231_20250622163643_49827131.jpg', '192.168.1.231_IPCamera 02_192.168.1.231_20250622163643_49849783.jpg', '192.168.1.231_IPCamera 02_192.168.1.231_20250622164056_50059266.jpg', '192.168.1.231_IPCamera 02_192.168.1.231_20250622165421_50595261.jpg', '192.168.1.231_IPCamera 02_192.168.1.231_20250622165627_51121655.jpg', '192.168.1.231_IPCamera 02_192.168.1.231_20250622170606_51519127.jpg', '192.168.1.231_IPCamera 02_192.168.1.231_20250622170622_51556020.jpg', '192.168.1.231_IPCamera 02_192.168.1.231_20250622170646_51588671.jpg', '192.168.1.231_IPCamera 02_192.168.1.231_20250622170648_51950946.jpg', '192.168.1.231_IPCamera 02_192.168.1.231_20250622171444_52107516.jpg', '192.168.1.231_IPCamera 02_192.168.1.231_20250622171949_52140129.jpg', '192.168.1.231_IPCamera 02_192.168.1.231_20250622171957_52151779.jpg', '192.168.1.231_IPCamera 02_192.168.1.231_20250622180647_52306027.jpg', '192.168.1.231_IPCamera 02_192.168.1.231_20250622180702_52330842.jpg', '192.168.1.231_IPCamera 03_192.168.1.231_20250531064118_2903897.jpg', '192.168.1.231_IPCamera 03_192.168.1.231_20250531064139_2961708.jpg', '192.168.1.231_IPCamera 03_192.168.1.231_20250531064243_3125781.jpg', '192.168.1.231_IPCamera 03_192.168.1.231_20250531064250_3143937.jpg', '192.168.1.231_IPCamera 03_192.168.1.231_20250531064331_240409.jpg', '192.168.1.231_IPCamera 03_192.168.1.231_20250531064631_298100.jpg', '192.168.1.231_IPCamera 03_192.168.1.231_20250531064632_301698.jpg', '192.168.1.231_IPCamera 03_192.168.1.231_20250531064724_376964.jpg', '192.168.1.231_IPCamera 03_192.168.1.231_20250531073031_1240671.jpg', '192.168.1.231_IPCamera 03_192.168.1.231_20250531073714_1322378.jpg', '192.168.1.231_IPCamera 03_192.168.1.231_20250531074401_1383102.jpg', '192.168.1.231_IPCamera 03_192.168.1.231_20250531075217_1477859.jpg', '192.168.1.231_IPCamera 03_192.168.1.231_20250531075436_1555975.jpg', '192.168.1.231_IPCamera 03_192.168.1.231_20250531080359_7590253.jpg', '192.168.1.231_IPCamera 03_192.168.1.231_20250531080642_7629164.jpg', '192.168.1.231_IPCamera 03_192.168.1.231_20250531081614_7740876.jpg', '192.168.1.231_IPCamera 03_192.168.1.231_20250531082411_7824238.jpg', '192.168.1.231_IPCamera 03_192.168.1.231_20250531082820_7884612.jpg', '192.168.1.231_IPCamera 03_192.168.1.231_20250531083636_7975888.jpg', '192.168.1.231_IPCamera 03_192.168.1.231_20250531084052_8028183.jpg', '192.168.1.231_IPCamera 03_192.168.1.231_20250531084053_120744.jpg', '192.168.1.231_IPCamera 03_192.168.1.231_20250531084713_257291.jpg', '192.168.1.231_IPCamera 03_192.168.1.231_20250531084735_409652.jpg', '192.168.1.231_IPCamera 03_192.168.1.231_20250531085111_502008.jpg', '192.168.1.231_IPCamera 03_192.168.1.231_20250531085122_458370.jpg', '192.168.1.231_IPCamera 03_192.168.1.231_20250531085839_1232493.jpg', '192.168.1.231_IPCamera 03_192.168.1.231_20250531085848_1246764.jpg', '192.168.1.231_IPCamera 03_192.168.1.231_20250531090224_1327292.jpg', '192.168.1.231_IPCamera 03_192.168.1.231_20250531090227_1296164.jpg', '192.168.1.231_IPCamera 03_192.168.1.231_20250531090834_1508424.jpg', '192.168.1.231_IPCamera 03_192.168.1.231_20250531090916_8641329.jpg', '192.168.1.231_IPCamera 03_192.168.1.231_20250531091227_8716204.jpg', '192.168.1.231_IPCamera 03_192.168.1.231_20250531092014_8822201.jpg', '192.168.1.231_IPCamera 03_192.168.1.231_20250531092035_8851759.jpg', '192.168.1.231_IPCamera 03_192.168.1.231_20250531092403_8897523.jpg', '192.168.1.231_IPCamera 03_192.168.1.231_20250531093013_9009659.jpg', '192.168.1.231_IPCamera 03_192.168.1.231_20250531093028_9028092.jpg', '192.168.1.231_IPCamera 03_192.168.1.231_20250531093356_38442459.jpg', '192.168.1.231_IPCamera 03_192.168.1.231_20250531093716_38574040.jpg', '192.168.1.231_IPCamera 03_192.168.1.231_20250531094130_38678923.jpg', '192.168.1.231_IPCamera 03_192.168.1.231_20250531094454_38719138.jpg', '192.168.1.231_IPCamera 03_192.168.1.231_20250531094620_38818312.jpg', '192.168.1.231_IPCamera 03_192.168.1.231_20250531095309_38880313.jpg', '192.168.1.231_IPCamera 03_192.168.1.231_20250531095310_38885667.jpg', '192.168.1.231_IPCamera 03_192.168.1.231_20250531095414_38955346.jpg', '192.168.1.231_IPCamera 03_192.168.1.231_20250531095427_38984918.jpg', '192.168.1.231_IPCamera 03_192.168.1.231_20250531100817_39054692.jpg', '192.168.1.231_IPCamera 03_192.168.1.231_20250531101733_39136099.jpg', '192.168.1.231_IPCamera 03_192.168.1.231_20250531103630_65994.jpg', '192.168.1.231_IPCamera 03_192.168.1.231_20250531104642_173092.jpg', '192.168.1.231_IPCamera 03_192.168.1.231_20250531110127_236659.jpg', '192.168.1.231_IPCamera 03_192.168.1.231_20250531110527_444825.jpg', '192.168.1.231_IPCamera 03_192.168.1.231_20250531111213_876299.jpg', '192.168.1.231_IPCamera 03_192.168.1.231_20250531111557_964497.jpg', '192.168.1.231_IPCamera 03_192.168.1.231_20250531112203_1329773.jpg', '192.168.1.231_IPCamera 03_192.168.1.231_20250531122039_1525190.jpg', '192.168.1.231_IPCamera 03_192.168.1.231_20250531124450_1931992.jpg', '192.168.1.231_IPCamera 03_192.168.1.231_20250531124813_1985859.jpg', '192.168.1.231_IPCamera 03_192.168.1.231_20250531124952_2117607.jpg', '192.168.1.231_IPCamera 03_192.168.1.231_20250531125313_2178441.jpg', '192.168.1.231_IPCamera 03_192.168.1.231_20250531125741_2231311.jpg', '192.168.1.231_IPCamera 03_192.168.1.231_20250531130757_2425699.jpg', '192.168.1.231_IPCamera 03_192.168.1.231_20250531131338_2476535.jpg', '192.168.1.231_IPCamera 03_192.168.1.231_20250531131943_2576712.jpg', '192.168.1.231_IPCamera 03_192.168.1.231_20250531133232_2689009.jpg', '192.168.1.231_IPCamera 03_192.168.1.231_20250531133736_2750834.jpg', '192.168.1.231_IPCamera 03_192.168.1.231_20250622091730_49692578.jpg', '192.168.1.231_IPCamera 03_192.168.1.231_20250622163654_49873700.jpg', '192.168.1.231_IPCamera 03_192.168.1.231_20250622164113_50275321.jpg', '192.168.1.231_IPCamera 03_192.168.1.231_20250622164130_50298028.jpg', '192.168.1.231_IPCamera 03_192.168.1.231_20250622165429_50609869.jpg', '192.168.1.231_IPCamera 03_192.168.1.231_20250622165450_51073921.jpg', '192.168.1.231_IPCamera 03_192.168.1.231_20250622165451_51078609.jpg', '192.168.1.231_IPCamera 03_192.168.1.231_20250622165657_51210410.jpg', '192.168.1.231_IPCamera 03_192.168.1.231_20250622170616_51548697.jpg', '192.168.1.231_IPCamera 03_192.168.1.231_20250622170632_51569537.jpg', '192.168.1.231_IPCamera 03_192.168.1.231_20250622170702_51972529.jpg', '192.168.1.231_IPCamera 03_192.168.1.231_20250622170717_51992660.jpg', '192.168.1.231_IPCamera 03_192.168.1.231_20250622171420_52066607.jpg', '192.168.1.231_IPCamera 03_192.168.1.231_20250622171422_52071917.jpg', '192.168.1.231_IPCamera 03_192.168.1.231_20250622171430_52085999.jpg', '192.168.1.231_IPCamera 03_192.168.1.231_20250622172007_52168825.jpg', '192.168.1.231_IPCamera 03_192.168.1.231_20250622172026_52194326.jpg', '192.168.1.231_IPCamera 03_192.168.1.231_20250622172027_52198260.jpg', '192.168.1.231_IPCamera 03_192.168.1.231_20250622180706_52335121.jpg', '192.168.1.231_IPCamera 03_192.168.1.231_20250622180725_52361450.jpg', '192.168.1.231_IPCamera 03_192.168.1.231_20250622180726_52365130.jpg', '192.168.1.231_IPCamera 04_192.168.1.231_20250531064118_2910072.jpg', '192.168.1.231_IPCamera 04_192.168.1.231_20250531064139_2966250.jpg', '192.168.1.231_IPCamera 04_192.168.1.231_20250531064243_3130016.jpg', '192.168.1.231_IPCamera 04_192.168.1.231_20250531064250_3144950.jpg', '192.168.1.231_IPCamera 04_192.168.1.231_20250531064331_238767.jpg', '192.168.1.231_IPCamera 04_192.168.1.231_20250531064631_295481.jpg', '192.168.1.231_IPCamera 04_192.168.1.231_20250531064724_378454.jpg', '192.168.1.231_IPCamera 04_192.168.1.231_20250531073031_1239296.jpg', '192.168.1.231_IPCamera 04_192.168.1.231_20250531073713_1318029.jpg', '192.168.1.231_IPCamera 04_192.168.1.231_20250531074353_1369990.jpg', '192.168.1.231_IPCamera 04_192.168.1.231_20250531075217_1475973.jpg', '192.168.1.231_IPCamera 04_192.168.1.231_20250531075436_1552362.jpg', '192.168.1.231_IPCamera 04_192.168.1.231_20250531080359_7591476.jpg', '192.168.1.231_IPCamera 04_192.168.1.231_20250531080643_7649686.jpg', '192.168.1.231_IPCamera 04_192.168.1.231_20250531081614_7743235.jpg', '192.168.1.231_IPCamera 04_192.168.1.231_20250531082411_7822783.jpg', '192.168.1.231_IPCamera 04_192.168.1.231_20250531082820_7885909.jpg', '192.168.1.231_IPCamera 04_192.168.1.231_20250531083636_7977130.jpg', '192.168.1.231_IPCamera 04_192.168.1.231_20250531084053_119271.jpg', '192.168.1.231_IPCamera 04_192.168.1.231_20250531084712_254882.jpg', '192.168.1.231_IPCamera 04_192.168.1.231_20250531084735_411221.jpg', '192.168.1.231_IPCamera 04_192.168.1.231_20250531085116_451215.jpg', '192.168.1.231_IPCamera 04_192.168.1.231_20250531085837_1230396.jpg', '192.168.1.231_IPCamera 04_192.168.1.231_20250531085848_1244623.jpg', '192.168.1.231_IPCamera 04_192.168.1.231_20250531090227_1294567.jpg', '192.168.1.231_IPCamera 04_192.168.1.231_20250531090242_1352342.jpg', '192.168.1.231_IPCamera 04_192.168.1.231_20250531090818_1484002.jpg', '192.168.1.231_IPCamera 04_192.168.1.231_20250531090833_1503327.jpg', '192.168.1.231_IPCamera 04_192.168.1.231_20250531090916_8639821.jpg', '192.168.1.231_IPCamera 04_192.168.1.231_20250531091229_8723785.jpg', '192.168.1.231_IPCamera 04_192.168.1.231_20250531091234_8730432.jpg', '192.168.1.231_IPCamera 04_192.168.1.231_20250531092010_8818502.jpg', '192.168.1.231_IPCamera 04_192.168.1.231_20250531092034_8847292.jpg', '192.168.1.231_IPCamera 04_192.168.1.231_20250531092406_8902490.jpg', '192.168.1.231_IPCamera 04_192.168.1.231_20250531093006_8999534.jpg', '192.168.1.231_IPCamera 04_192.168.1.231_20250531093408_38462743.jpg', '192.168.1.231_IPCamera 04_192.168.1.231_20250531093715_38530745.jpg', '192.168.1.231_IPCamera 04_192.168.1.231_20250531094128_38670216.jpg', '192.168.1.231_IPCamera 04_192.168.1.231_20250531094456_38724486.jpg', '192.168.1.231_IPCamera 04_192.168.1.231_20250531094620_38820783.jpg', '192.168.1.231_IPCamera 04_192.168.1.231_20250531095309_38877251.jpg', '192.168.1.231_IPCamera 04_192.168.1.231_20250531095411_38952071.jpg', '192.168.1.231_IPCamera 04_192.168.1.231_20250531095424_38969812.jpg', '192.168.1.231_IPCamera 04_192.168.1.231_20250531095426_38978262.jpg', '192.168.1.231_IPCamera 04_192.168.1.231_20250531100817_39057102.jpg', '192.168.1.231_IPCamera 04_192.168.1.231_20250531101733_39137248.jpg', '192.168.1.231_IPCamera 04_192.168.1.231_20250531103632_72477.jpg', '192.168.1.231_IPCamera 04_192.168.1.231_20250531104632_161563.jpg', '192.168.1.231_IPCamera 04_192.168.1.231_20250531110122_230733.jpg', '192.168.1.231_IPCamera 04_192.168.1.231_20250531110527_446714.jpg', '192.168.1.231_IPCamera 04_192.168.1.231_20250531111213_878258.jpg', '192.168.1.231_IPCamera 04_192.168.1.231_20250531111554_961415.jpg', '192.168.1.231_IPCamera 04_192.168.1.231_20250531112203_1333830.jpg', '192.168.1.231_IPCamera 04_192.168.1.231_20250531122039_1526782.jpg', '192.168.1.231_IPCamera 04_192.168.1.231_20250531124450_1927887.jpg', '192.168.1.231_IPCamera 04_192.168.1.231_20250531124813_1986982.jpg', '192.168.1.231_IPCamera 04_192.168.1.231_20250531124952_2115054.jpg', '192.168.1.231_IPCamera 04_192.168.1.231_20250531125313_2181002.jpg', '192.168.1.231_IPCamera 04_192.168.1.231_20250531125741_2233371.jpg', '192.168.1.231_IPCamera 04_192.168.1.231_20250531130757_2427134.jpg', '192.168.1.231_IPCamera 04_192.168.1.231_20250531131338_2478093.jpg', '192.168.1.231_IPCamera 04_192.168.1.231_20250531133232_2690999.jpg', '192.168.1.231_IPCamera 04_192.168.1.231_20250531133736_2752917.jpg', '192.168.1.231_IPCamera 04_192.168.1.231_20250622091729_49687997.jpg', '192.168.1.231_IPCamera 04_192.168.1.231_20250622091732_49699806.jpg', '192.168.1.231_IPCamera 04_192.168.1.231_20250622163654_49877130.jpg', '192.168.1.231_IPCamera 04_192.168.1.231_20250622164112_50273247.jpg', '192.168.1.231_IPCamera 04_192.168.1.231_20250622164127_50292778.jpg', '192.168.1.231_IPCamera 04_192.168.1.231_20250622165431_50612478.jpg', '192.168.1.231_IPCamera 04_192.168.1.231_20250622165450_51071552.jpg', '192.168.1.231_IPCamera 04_192.168.1.231_20250622165655_51202501.jpg', '192.168.1.231_IPCamera 04_192.168.1.231_20250622170616_51546711.jpg', '192.168.1.231_IPCamera 04_192.168.1.231_20250622170632_51570902.jpg', '192.168.1.231_IPCamera 04_192.168.1.231_20250622170700_51970548.jpg', '192.168.1.231_IPCamera 04_192.168.1.231_20250622170717_51993963.jpg', '192.168.1.231_IPCamera 04_192.168.1.231_20250622171422_52073776.jpg', '192.168.1.231_IPCamera 04_192.168.1.231_20250622171429_52084436.jpg', '192.168.1.231_IPCamera 04_192.168.1.231_20250622172009_52170458.jpg', '192.168.1.231_IPCamera 04_192.168.1.231_20250622172026_52192680.jpg', '192.168.1.231_IPCamera 04_192.168.1.231_20250622180704_52332829.jpg', '192.168.1.231_IPCamera 04_192.168.1.231_20250622180723_52355785.jpg', '192.168.1.231_IPCamera 04_192.168.1.231_20250622180725_52360105.jpg', '5a5b737483eeecc61f97306dd9bbd31.jpg', '66874453的互联_驶入(无地磅)_20250624090451_848932351.jpg', '66874453的互联_驶入(有地磅)_20250624090452_848884290.jpg', '66874453的互联_驶出(有地磅)_20250624090452_849003063.jpg']\n"
     ]
    }
   ],
   "source": [
    "import os\n",
    "import shutil\n",
    "\n",
    "# 输入文件夹路径\n",
    "folder1 = \"data/images_png\"  # 存放 JPG\n",
    "folder2 = \"data/labels\"  # 存放 TXT\n",
    "\n",
    "# 输出文件夹路径（可选，如果不想覆盖原文件，可以设置新的输出路径）\n",
    "output_folder1 = \"data/output/images\"\n",
    "output_folder2 = \"data/output/labels\"\n",
    "os.makedirs(output_folder1, exist_ok=True)\n",
    "os.makedirs(output_folder2, exist_ok=True)\n",
    "# 获取两个文件夹中的文件列表（按文件名排序）\n",
    "jpg_files = sorted([f for f in os.listdir(folder1) if f.lower().endswith(\".jpg\")])\n",
    "txt_files = sorted([f for f in os.listdir(folder2) if f.lower().endswith(\".txt\")])\n",
    "print(jpg_files)\n",
    "# # 确保文件数量一致（否则可能出错）\n",
    "# if len(jpg_files) != len(txt_files):\n",
    "#     print(\"警告：JPG 和 TXT 文件数量不一致！\")\n",
    "\n",
    "# # 开始重命名\n",
    "# for i, (jpg_file, txt_file) in enumerate(zip(jpg_files, txt_files), start=1):\n",
    "#     # 新文件名\n",
    "#     new_jpg_name = f\"{i}.jpg\"\n",
    "#     new_txt_name = f\"{i}.txt\"\n",
    "\n",
    "#     # 原文件完整路径\n",
    "#     old_jpg_path = os.path.join(folder1, jpg_file)\n",
    "#     old_txt_path = os.path.join(folder2, txt_file)\n",
    "\n",
    "#     # 新文件完整路径（可以指定输出文件夹，或直接覆盖原文件）\n",
    "#     new_jpg_path = os.path.join(output_folder1, new_jpg_name)\n",
    "#     new_txt_path = os.path.join(output_folder2, new_txt_name)\n",
    "\n",
    "#     # 执行重命名（复制到新位置）\n",
    "#     shutil.copy2(old_jpg_path, new_jpg_path)\n",
    "#     shutil.copy2(old_txt_path, new_txt_path)\n",
    "\n",
    "#     print(f\"重命名：{jpg_file} → {new_jpg_name}\")\n",
    "#     print(f\"重命名：{txt_file} → {new_txt_name}\")\n",
    "\n",
    "# print(\"\\n所有文件重命名完成！\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "60a54e9e",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "yolo",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.9.23"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
